#include "logger_test.h"

namespace Ballade
{
	
	namespace Util
	{	
		CPPUNIT_TEST_SUITE_REGISTRATION(LoggerTest);
		
		void LoggerTest::setUp()
		{
			_logger = &Logger::getInstance();
		}
		
		void LoggerTest::tearDown()
		{
			_logger->close();
		}
		
		void LoggerTest::testDefaultIsDebug()
		{
			CPPUNIT_ASSERT(_logger->isDebugEnabled());
		}
		
		void LoggerTest::testDebugEnabled()
		{
			_logger->setLevel(Logger::Level::DEBUG_);
			CPPUNIT_ASSERT(_logger->isDebugEnabled());
		}
		
		void LoggerTest::testInfoEnabled()
		{
			_logger->setLevel(Logger::Level::INFO_);
			CPPUNIT_ASSERT(_logger->isInfoEnabled());
			CPPUNIT_ASSERT(Logger::getInstance().isInfoEnabled());
		}
		
		void LoggerTest::testWarnEnabled()
		{
			_logger->setLevel(Logger::Level::WARN_);
			CPPUNIT_ASSERT(_logger->isWarnEnabled());
			CPPUNIT_ASSERT(Logger::getInstance().isWarnEnabled());
		}
		
		void LoggerTest::testErrorEnabled()
		{
			_logger->setLevel(Logger::Level::ERROR_);
			CPPUNIT_ASSERT(_logger->isErrorEnabled());
			CPPUNIT_ASSERT(Logger::getInstance().isErrorEnabled());
		}
		
		void LoggerTest::testFatalEnabled()
		{
			_logger->setLevel(Logger::Level::FATAL_);
			CPPUNIT_ASSERT(_logger->isFatalEnabled());
			CPPUNIT_ASSERT(Logger::getInstance().isFatalEnabled());
		}
	}

}